Text resources processing in an application

ABSTRACT

Embodiments of the present disclosure relate to text resources in an application. According to a method, an updated application is run, wherein information displayed on at least one text resource in the updated application is editable and the information displayed on at least one text resource in an original application of the updated application is not editable. Then, in response to a first piece of information displayed on a text resource of the at least one text resource being changed to a second piece of information, ID of the text resource of the at least one text resource in the updated application is obtained; and the second piece of information is mapped to the ID of the text resource in a file corresponding to the at least one text resource in the updated application.

FIELD OF THE INVENTION

The present disclosure relates to the field of information processingtechnology, and more specifically, to text resources processing in anapplication.

BACKGROUND

A product may comprise at least one application. During development ofthe product, text resources in applications of the product usually needto be displayed in multiple languages. This is referred to as“globalization” or National Language Support (NLS) by programmers. Textresources include, but are not limited to, the following resources:checkbox, menu, popup, panel, text field, table, title, link, widget,window, frame, dialogue, applet, message, hint, tooltips, option,button, label, form, etc. Text information will be displayed on theseresources, so they are referred to herein as text resources.Application, as used herein, means an application program which can berun in a specific environment. In current implementations of a productglobalization development, developers often package all text resourcesinto a language resource file and then send the language resource fileto a translator. The language resource file comprises an ID of each textresource and information to be displayed on each text resource in anoriginal language. The information to be displayed on each text resourcein the original language needs to be translated into other languages bythe translator. After translation, the translator returns the NLS sourcefile, which comprises all the IDs of the text resources and thetranslation of the information in another language as requested, to thedeveloper or a tester. Thereby the developer or the tester can check-inthe NLS source file for the product, and review the translatedinformation displayed on the text resource, either by running theproduct after the product is built and deployed, or by taking screencaptures sent to testers, to check correctness of the translation in theproduct.

SUMMARY

Example embodiments of the present disclosure provide a method, adevice, and a computer program product for text resources globalizationin an application.

In an aspect, a computer-implemented method is provided. According tothe method, an updated application is run, wherein information displayedon at least one text resource in the updated application is editable andthe information displayed on at least one text resource in an originalapplication of the updated application is not editable. Then, inresponse to a first piece of information displayed on a text resource ofthe at least one text resource being changed to a second piece ofinformation, an ID of the text resource of the at least one textresource in the updated application is obtained, and then the secondpiece of information is mapped to the ID of the text resource in a filecorresponding to the at least one text resource in the updatedapplication.

In another aspect, a device is provided. The device includes aprocessing unit and a memory coupled to the processing unit and storinginstructions thereon. The instructions can be executed by the processingunit to perform acts including: running an updated application, whereininformation displayed on at least one text resource in the updatedapplication is editable and the information displayed on at least onetext resource in an original application of the updated application isnot editable; in response to a first piece of information displayed on atext resource of the at least one text resource being changed to asecond piece of information, obtaining ID of the text resource of the atleast one text resource in the updated application; and mapping thesecond piece of information to the ID of the text resource in a filecorresponding to the at least one text resource in the updatedapplication.

In yet another aspect, a computer program product is provided. Thecomputer program product is tangibly stored on a non-transientmachine-readable medium and comprises machine-executable instructions.When executed on a device, the instructions cause the device to run anupdated application, wherein information displayed on at least one textresource in the updated application is editable and the informationdisplayed on at least one text resource in an original application ofthe updated application is not editable; in response to a first piece ofinformation displayed on a text resource of the at least one textresource being changed to a second piece of information, obtain ID ofthe text resource of the at least one text resource in the updatedapplication; and map the second piece of information to the ID of thetext resource in a file corresponding to the at least one text resourcein the updated application.

It is to be understood that the Summary is not intended to identify keyor essential features of embodiments of the present disclosure, nor isit intended to be used to limit the scope of the present disclosure.Other features of the present disclosure will become easilycomprehensible through the description below.

BRIEF DESCRIPTION OF THE DRAWINGS

Through the more detailed description of some embodiments of the presentdisclosure in the accompanying drawings, the above and other objects,features and advantages of the present disclosure will become moreapparent, wherein:

FIG. 1 is a block diagram of an electronic device suitable forimplementing embodiments of the present disclosure;

FIG. 2 is an exemplary user interface (UI) 200 of an application inwhich embodiments of the present disclosure can be applied;

FIG. 3 is another exemplary user interface (UI) 300 of an application inwhich embodiments of the present disclosure can be applied;

FIG. 4 is an exemplary language resource file of UI 200 or UI 300 in xmlformat;

FIG. 5 is an exemplary NLS resource file for Chinese translation for UI200 and UI 300 in xml format

FIG. 6 is a flowchart of a method for text resources globalization in anupdated application in accordance with embodiments of the presentdisclosure;

FIG. 7 is a flowchart of the method for changing source code of anapplication to make information displayed on at least one text resourcein the application editable;

FIG. 8 shows exemplary resources included in the source code of theapplication comprising UI 200 or UI 300;

FIG. 9 shows the content in the file named “Sample string properties” inFIG. 8;

FIG. 10 is a flowchart of the method for changing html code of anapplication to make information displayed on at least one text resourcein the application editable; and

FIG. 11 is an exemplary interface of FIG. 2 with the first variableidentifier and the second variable identifier corresponding to the ID ofthe text resource “Sample_Label1”.

Throughout the drawings, the same or similar reference numeralsrepresent the same or similar elements.

DETAILED DESCRIPTION

The principles of the present disclosure will now be described withreference to some example embodiments. It is to be understood that theseembodiments are described only for the purpose of illustration and helpthose skilled in the art to understand and implement the presentdisclosure, without suggesting any limitations as to the scope of thedisclosure. The disclosure described herein can be implemented invarious manners other than the ones describe below.

As used herein, the term “includes” and its variants are to be read asopen terms that mean “includes, but is not limited to.” The term “basedon” is to be read as “based at least in part on.” The term “oneembodiment” and “an embodiment” are to be read as “at least oneembodiment.” The term “another embodiment” is to be read as “at leastone other embodiment.” Other definitions, explicit and implicit, may beincluded below.

The terminology used herein is for the purpose of describing particularembodiments only and is not intended to be limiting of this disclosure.As used herein, the singular forms “a”, “an”, and “the” are intended toinclude the plural forms as well, unless the context clearly indicatesotherwise. Furthermore, the use of the terms “a”, “an”, etc., do notdenote a limitation of quantity, but rather denote the presence of atleast one of the referenced items. The term “set” is intended to mean aquantity of at least one. It will be further understood that the terms“comprises” and/or “comprising”, or “includes” and/or “including”, or“has” and/or “having”, when used in this specification, specify thepresence of stated features, regions, integers, steps, operations,elements, and/or components, but do not preclude the presence oraddition of one or more other features, regions, integers, steps,operations, elements, components, and/or groups thereof.

Reference is first made to FIG. 1, in which an exemplary electronicdevice or computer system/server 12 which is applicable to implement theembodiments of the present disclosure is shown. Computer system/server12 is only illustrative and is not intended to suggest any limitation asto the scope of use or functionality of embodiments of the disclosuredescribed herein.

As shown in FIG. 1, computer system/server 12 is shown in the form of ageneral-purpose computing device. The components of computersystem/server 12 may include, but are not limited to, one or moreprocessors or processing units 16, a system memory 28, and a bus 18 thatcouples various system components including system memory 28 toprocessor 16.

Bus 18 represents one or more of any of several types of bus structures,including a memory bus or memory controller, a peripheral bus, anaccelerated graphics port, and a processor or local bus using any of avariety of bus architectures. By way of example, and not limitation,such architectures include Industry Standard Architecture (ISA) bus,Micro Channel Architecture (MCA) bus, Enhanced ISA (EISA) bus, VideoElectronics Standards Association (VESA) local bus, and PeripheralComponent Interconnect (PCI) bus.

Computer system/server 12 typically includes a variety of computersystem readable media. Such media may be any available media that isaccessible by computer system/server 12, and it includes both volatileand non-volatile media, removable and non-removable media.

System memory 28 can include computer system readable media in the formof volatile memory, such as random access memory (RAM) 30 and/or cachememory 32. Computer system/server 12 may further include otherremovable/non-removable, volatile/non-volatile computer system storagemedia. By way of example only, storage system 34 can be provided forreading from and writing to a non-removable, non-volatile magnetic media(not shown and typically called a “hard drive”). Although not shown, amagnetic disk drive for reading from and writing to a removable,non-volatile magnetic disk (e.g., a “floppy disk”), and an optical diskdrive for reading from or writing to a removable, non-volatile opticaldisk such as a CD-ROM, DVD-ROM or other optical media can be provided.In such instances, each can be connected to bus 18 by one or more datamedia interfaces. As will be further depicted and described below,memory 28 may include at least one program product having a set (e.g.,at least one) of program modules that are configured to carry out thefunctions of embodiments of the disclosure.

Program/utility 40, having a set (at least one) of program modules 42,may be stored in memory 28 by way of example, and not limitation, aswell as an operating system, one or more application programs, otherprogram modules, and program data. Each of the operating system, one ormore application programs, other program modules, and program data orsome combination thereof, may include an implementation of a networkingenvironment. Program modules 42 generally carry out the functions and/ormethodologies of embodiments of the disclosure as described herein.

Computer system/server 12 may also communicate with one or more externaldevices 14 such as a keyboard, a pointing device, a display 24, and thelike. One or more devices that enable a user to interact with computersystem/server 12; and/or any devices (e.g., network card, modem, etc.)that enable computer system/server 12 to communicate with one or moreother computing devices. Such communication can occur via input/output(I/O) interfaces 22. Still yet, computer system/server 12 cancommunicate with one or more networks such as a local area network(LAN), a general wide area network (WAN), and/or a public network (e.g.,the Internet) via network adapter 20. As depicted, network adapter 20communicates with the other components of computer system/server 12 viabus 18. It should be understood that although not shown, other hardwareand/or software components could be used in conjunction with computersystem/server 12. Examples, include, but are not limited to: microcode,device drivers, redundant processing units, external disk drive arrays,RAID systems, tape drives, and data archival storage systems, and thelike.

In computer system/server 12, I/O interfaces 22 may support one or moreof various different input devices that can be used to provide input tocomputer system/server 12. For example, the input device(s) may includea user device such keyboard, keypad, touch pad, trackball, and the like.The input device(s) may implement one or more natural user interfacetechniques, such as speech recognition, touch and stylus recognition,recognition of gestures in contact with the input device(s) and adjacentto the input device(s), recognition of air gestures, head and eyetracking, voice and speech recognition, sensing user brain activity, andmachine intelligence.

In current implementations of product globalization development, NLSsource files are separated from user interface (UI) of applications inthe product. They are verified alone. If an error in the translation isfound, the error has to be returned to the translator for correction.After the translator corrects the errors in the NLS file and returns theupdated NLS source file, the developer or the tester has to check-in theupdated NLS source file, build and deploy the product again. Then eitherof them can view the translated information displayed on the textresource. So any translation correction needs to go back to translators.And programmers need to get updated NLS source file from thetranslators, check-in the updated NLS source file, build and deploy theproduct, and then verify the translation from the UI.

The implementation leads to duplicate efforts and impacts the quality,as the globalization engineer (including translators, programmers andtesters) can't actually see the changes he/she made directly. It is alsotime consuming.

An improved method, system and program product for text resourcesglobalization in an application is provided according to embodiments ofthe present invention in which translators can translate text resourcesin the context of the application, and programmers or testers canactually see the changes they made.

FIG. 2 is an exemplary user interface (UI) 200 of an application inwhich embodiments of the present disclosure can be applied. The UI 200is a web browser UI whose source code is based on JavaScript and HTML.In the example, the default language of the UI 200 is English, so theinformation displayed on text resources of UI 200 is in English, but itneeds to be translated into other languages, such as Chinese, to satisfythe NLS requirement. In FIG. 2, the four pieces of information displayedon four text resources in the original language are “Name”, “Mailaddress”, “Email address”, and “Submit” respectively. From FIG. 2, itcan be understood that the information displayed on the four textresources in original language on UI 200 cannot be edited.

FIG. 3 is another exemplary user interface (UI) 300 of an application inwhich embodiments of the present disclosure can be applied. The UI 300is not a web browser UI, but instead a Java-based UI. The defaultlanguage of the UI 300 is English. The information displayed on textresources of UI 300 is in English and needs to be translated into otherlanguages, such as Chinese, to satisfy the NLS requirement. In FIG. 3,the information displayed on each of the four text resources in originallanguage is “Name”, “Mail address” (two instances), “Email address”, and“Submit” respectively. From FIG. 3, it can be understood that theinformation displayed on the four text resources in original language onUI 300 cannot be edited.

An exemplary language resource file of the UI 200 or the UI 300 in xmlformat is shown in FIG. 4. In the language resource file, it can be seenthat the four text resource IDs are sample_button, sample_label1,sample_label2, and sample_hint respectively, and four pieces ofinformation displayed on the four text resources in original languageare Submit, Name:, Mail address:, and Email address respectively.

When the displayed information on UI 200 or UI 300 needs to betranslated into Chinese, FIG. 5 is an exemplary NLS resource file forChinese translation for UI 200 and UI 300 in xml format.

If the information displayed on the text resources on UI 200 or UI 300were editable, a programmer or a tester would be able to make a changeto the information displayed on the text resource when viewing theproduct UI or screen-capture, so as to modify translation errors in NLSfile.

FIG. 6 is a flowchart of a method 600 for text resources globalizationin an updated application in accordance with embodiments of the presentdisclosure. In some embodiments, the method 600 can be a plug-in of adevelopment tool running on a machine. As used herein, the term“machine” may refer to a physical machine, a virtual machine (VM) or anyother suitable computing platform. The development tool can read thesource code of an application with at least one UI, such as UI 200 andUI 300, and build, deploy and then run the application.

Referring to FIG. 6, in step 601, an updated application is run, whereininformation displayed on at least one text resource in the updatedapplication is editable and information displayed on at least one textresource in an original application of the updated application is noteditable. Here the original application and the updated application canbe regarded as same application in different versions, e.g. a textresource in the original application has a corresponding text resourcein the updated application. And here information displayed on the atleast one text resource in the application is supposed to be editable,and the method on how to make it editable is described herein. In step602, it is determined whether a first piece of information displayed ona text resource is changed to a second piece of information. If yes, theprocess proceeds to step 603, where an ID of the text resource isobtained. In step 604, it is determined whether a file corresponding tothe at least one text resource in the updated application exists. Ifyes, then in step 605, the second piece of information is mapped to theID of the text resource in the file corresponding to the at least onetext resource in the updated application. If not, then in step 606, thefile is created, and the process proceeds to step 605. This process canapply to multiple text resources within a user interface. Also note,that here the execution sequence of the step 602 and the step 603 can beexchanged, e.g the ID of the text resource can be obtained before thedetermining step 602.

In the above embodiment, if the file exists, it can be known thattranslators have made translation for the text resource. If aprogrammers or a tester finds a translation error when reviewing theproduct UI, he/she can make a change to the file via the UI at any timeand the change can be effective at once. Thus there is no need to goback to the translators. This method can save the time of theprogrammers or the testers. Additionally, in the above embodiment, ifthe file does not exist, the file can be created at step 606, so thetranslators can then make a translation for the text resources. Usingthe method, the translator can get the context of a text resource so asto make the translation more correct to reduce the burden of programmersand testers.

In the method 600, the information displayed on at least one textresource in the updated application is required to be editable so thattranslators, programmers or testers can input or change translation ofthe information in a context of a text resource. In accordance withembodiments of the present disclosure, programmers can write source codeof an application to make text resources editable in the application. Inone embodiment, he/she can write a source code with editable textresource component, and then when the application is run, the textresource is shown to be edited.

However, when an application is released, it is required that allinformation displayed on text resources should not be edited. So inanother alternative embodiment, the programmer may set a variableidentifier in the source code of the application. If the variableidentifier is a first value, the text resources in the source code ofthe application cannot be edited; if the variable identifier is a secondvalue, the text resources in the source code of the application can beedited. The variable identifier can be enabled from the UI by the userso that when the updated source code is built, deployed to get anupdated application, the text resources in the UI of the updatedapplication can be enabled to be edited or not.

Function of enabling the information displayed on at least one textresource in the application to be edited when programming will costprogrammer extra effort. And when the application is released, thefunction has to be disabled by setting the variable identifier to thefirst value. The invention provides a method to automatically change thesource code of an application to make the information displayed on atleast one text resource in the application editable. In someembodiments, the method is a plug-in in a development tool. When theplug-in is initiated, the method will be executed. FIG. 7 is a flowchartof the method for changing the source code of an application to make theinformation displayed on at least one text resource in the applicationeditable. According to FIG. 7, in step 701, source code of theapplication is obtained. In step 702, a type of the source code, an IDof the at least one text resource, and code templates related to thetype of the source code are determined. Here code templates comprisecode with editable text resources according to the type of the sourcecode. In step 703, the ID of each text resource, of the at least onetext resource, is input into the code templates to get replacedtemplates, and in step 704, the replaced templates are added into thesource code to get updated source code. In step 705, the updated sourcecode is built, and deployed to get the updated application. In therunning updated application, the information displayed on the at leastone text resource in the application is editable.

For example, when the method 700 is applied to the applicationcomprising UI 200 in FIG. 2, the following HTML code is a part of sourcecode corresponding to the UI 200 in the application, referring as “UI200 HTML code” in the invention.

<html> <head> </head> <body> <form class=“form-inline” role=“form”> <label id=“Sample_Label1”>Name </label>   <input type “text”class=“form-control”>   <label id=“Sample_Label2”> Mail Address <label> <input id=“Sample_Hint” type=“text” class=“form-control”placeholder=“Email Address ”> <buttonid=“Sample_Button” >Submit</button> </form> </body> </html>

The type of the source code can be identified from the above html code,e.g. the type of the source code is JavaScript and html. The source codeof the application also includes resources. FIG. 8 shows exemplaryresources included in the source code of the application comprising UI200 or the application comprising UI 300. Since the original informationof a text resource is displayed in English, FIG. 9 shows the content inthe file named “Sample string_en properties” at 802 in FIG. 8. And theID of the at least one text resource can be identified from the contentof the file in FIG. 9.

And because the type of the source code is JavaScript and html, thefollowing code template (with the help of JQuery library) for type ofJavaScript and html is determined. In this invention, all code templatesfor all source code types have been saved in the plug-in code, which canbe obtained according to the source code type.

<script> var original_message = $(“[id=‘Text resource ID’]”).text;$(“[id=‘ Text resource ID ’]”).replaceWith(“<input id=‘ Text resource ID’ type=‘text’ placeholder=$(this).original_message>”); </script>The above code template is just exemplary, so it should be recognizedthat there are many other ways to implement it within the scope andspirit of the invention. For example, the code template (without help ofJQuery library) for type of JavaScript and html can also be written asthe following:

<script> var original_message = document.body.getElementByTag(“TextResource ID”).text; document.bodygetElementByTag(“Text ResourceID”).innerHTML=“<input id=‘ Text resource ID ’ type=‘text’placeholder=this.original_message>” <script>From this example, those skilled in the art can understand that theremay be more than one type of code template for one source code type.

Moreover, there are four text resources in UI 200, and their textresource IDs are Sample_Label1, Sample_Label2, Sample_Button, andSample_Hint, respectively. The four text resource IDs are obtained fromthe file in FIG. 9. Then the four obtained IDs of the text resources areinput into the above template to get replaced templates. Following arethe replaced templates for the application.

<script> var original_message = $(“[id=‘Sample_Label1’]”).text;$(“[id=‘Sample_Label1’]”).replaceWith(“<input id=‘Sample_Label1 ’type=‘text’ placeholder=$(this).original_message>”); original_message =$(“[id=‘Sample_Label2’]”).text;$(“[id=‘Sample_Label1’]”).replaceWith(“<input id=‘Sample_Label2’type=‘text’ placeholder=$(this).original_message>”); original_message =$(“[id=‘Sample_Button’]”).text;$(“[id=‘Sample_Label1’]”).replaceWith(“<input id=‘Sample_Button’type=‘text’ placeholder=$(this).original_message>”); original_message =$(“[id=‘Sample_Hint’]”).text;$(“[id=‘Sample_Label1’]”).replaceWith(“<input id=‘Sample_Hint’type=‘text’ placeholder=$(this).original_message>”); </script>

The above replaced templates can be in an individual script file in thesource code and a reference for the individual script file can be usedin UI 200 HTML file. For example, if above replaced templates code isstored in a file named replace.js then, following code referring to thisfile can be used in the UI 200 HTML code as the reference.

-   <script src=“replace.js”></script>

The above reference can be thought as part of template for the type ofthe source code. Then the above replaced templates code are added intothe source code to get updated source code, and then the updated sourcecode can be built, deployed to get the updated application. When theupdated application is nm, the information displayed on the four textresources in the application is editable.

In another example, when the method 700 is applied to the applicationcomprising UI 300 in FIG. 3, the following Java code is part of sourcecode corresponding to UI 300 in the application, named “UI 300 Javacode” in the other part of the application.

public class UserLoginPage extends JFrame implements ActionListener { @GlobalizationAnnotation  private JComponent lblUsername; @GlobalizationAnnotation  private JComponent lblPassword;  privateJTextField tfUsername;  private JTextField tfEmail; @GlobalizationAnnotation  private JComponent btnOk;  publicUserLoginPage( ) { //the sample label item of “Name:”   JPanel p1 = newJPanel( );   p1.setLayout(new BorderLayout( ));   lblUsername = newJLabel(ResourceHelper.MSG.getMessage(“Sample_Label1’));   tfUsername =new HintTextField(“”);   tfUsername.setPreferredSize(newDimension(300,50));   p1.add(lblUsername, BorderLayout.WEST);  p1.add(tfUsername, BorderLayout.EAST);   p1.setPreferredSize(newDimension(500,50)); //the sample label item of “Mail Address”   JPanelp2 = new JPanel( );   p2.setLayout(new BorderLayout( ));   lblPassword =new JLabel(ResourceHelper.MSG.getMessage(“Sample_Label2”));  p2.add(lblPassword, BorderLayout.WEST);   p2.setPreferredSize(newDimension(250,50)); //the sample hint item of “Email Address”   JPanelp3 = new JPanel( );   p3.setLayout(new BorderLayout( ));   tfEmail = newHintTextField(ResourceHelper.MSG.getMessage(“Sample_Hint”));  tfEmail.setPreferredSize(new Dimension(250,50));   p3.add(tfEmail,BorderLayout.WEST);   p3.setPreferredSize(new Dimension(250,50)); //thesample button item of “Submit”   JPanel p4 = new JPanel( );   btnOK =new JButton(ResourceHelper.MSG.getMessage(“Sample_Button”));  p4.add(btnOK);   this.add(p1, BorderLayout.NORTH);   this.add(p2,BorderLayout.WEST);   this.add(p3, BorderLayout.EAST);   this.add(p4,BorderLayout.SOUTH);   this.setLocation(450, 300);   this.setSize(500,400);   this.setPreferredSize(new Dimension(500, 400));  this.setTitle(“Mail Address”);  this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);  this.setVisible(true);  }  public static void main(String[ ] args) {  //run and display the user login page   new UserLoginPage( );  } }

The type of the source code can be identified from the above Java code,e.g., the type of the source code is Java. Similar to FIG. 8, the sourcecode of the application also includes resources and the originalinformation of a text resource is similar to the content in FIG. 9. Andthe ID of the at least one text resource can be identified from thecontent of the file similar to the file in FIG. 9.

And because the type of the source code is Java, the following codetemplate for type of Java is determined from the plug-in which storesall code templates for all types of source code.

if(lineTxt.indexOf(“JLabel”)!=−1 && messageId.equals(“Text resourceID”)){  update = lineTxt.replaceAll(“JLabel”, “JTextField”); }if(lineTxt.indexOf(“JButton”)!=−1 && messageId.equals(“Text resourceID”)){  update = lineTxt.replaceAll(“JButton ”, “JTextField”); }if(lineTxt.indexOf(“JTextField”)!=−1 && messageId.equals(“Text resourceID”)){  update = lineTxt.replaceAll(“JTextField ”, “JTextField”); }

The four text resources IDs, namely Sample_Label1, Sample_Label2,Sample_Button, and Sample_Hint, are obtained from the file similar tothe file in FIG. 9. Then the four obtained IDs of the text resources areinput into the above code template to get replaced code templates.Following are the replaced code templates.

if(lineTxt.indexOf(“JLabel”)!=−1 && messageId.equals(“Sample_Label1”)){  update = lineTxt.replaceAll(“JLabel”, “JTextField”);  } if(lineTxt.indexOf(“JLabel”)!=−1 && messageId.equals(“Sample_Label2”)){  update = lineTxt.replaceAll(“JLabel”, “JTextField”);  } if(lineTxt.indexOf(“JButton”)!=−1 &&messageId.equals(“Sample_Button”)){   update=lineTxt.replaceAll(“JButton”, “JTextField”);  } if(lineTxt.indexOf(“JTextField”)!=−1 &&messageId.equals(“Sample_Hint”)){   update =lineTxt.replaceAll(“JTextField”, “JTextField”);

In this example, the following code (excluding the replaced codetemplates) can be thought as part of templates for the type of thesource code. Then the above replaced templates code for the type of thesource code are added into the application source code to get updatedsource code,

public class TransformForTranslate {  public static void main(String[ ]args) throws IOException { //this is just the folder of source code  String source = “D:\\wkspc\\src\\com\\ibm\\demo\\UserLogin.java”;  String target =“D:\\wkspc\\src\\com\\ibm\\demo\\UserLoginTranslateMode.java”;   File f= new File(source);   InputStreamReader read = new InputStreamReader(newFileInputStream(f));   BufferedReader bufferedReader = newBufferedReader(read);   BufferedWriter out = new BufferedWriter(newFileWriter(target));   String lineTxt = null; //read the java code lineby line and update globalization items   while ((lineTxt =bufferedReader.readLine( )) != null) {    String update = lineTxt;String messageId = getMessageId(lineTxt);   if(lineTxt.indexOf(“JLabel”)!=−1 &&messageId.equals(“Sample_Label1”)){     update =lineTxt.replaceAll(“JLabel”, “JTextField”);    }   if(lineTxt.indexOf(“JLabel”)!=−1 &&messageId.equals(“Sample_Label2”)){     update =lineTxt.replaceAll(“JLabel”, “JTextField”);    }   if(lineTxt.indexOf(“JButton”)!=−1 &&messageId.equals(“Sample_Button”)){     update =lineTxt.replaceAll(“JButton”, “JTextField”);    }   if(lineTxt.indexOf(“JTextField”)!=−1 &&messageId.equals(“Sample_Hint”)){     update =lineTxt.replaceAll(“JTextField”, “JTextField”);    }   out.write(update);    out.newLine( );   }   read.close( );  out.flush( );   out.close( );  }  } public class UserLoginPageUpdatedextends JFrame implements ActionListener {  @GlobalizationAnnotation private JComponent lblUsername;  @GlobalizationAnnotation  privateJComponent lblPassword;  private JTextField tfUsername;  privateJTextField tfEmail;  @GlobalizationAnnotation  private JComponent btnOK; public UserLoginPageUpdated( ) {   JPanel p1 = new JPanel( );  p1.setLayout(new BorderLayout( ));   lblUsername = newJTextField(ResourceHelper.MSG.getMessage(“Sample_Label1”));   tfUsername= new HintTextField(“”);   tfUsername.setPreferredSize(newDimension(300,50));   p1.add(lblUsername, BorderLayout.WEST);  p1.add(tfUsername, BorderLayout.EAST);   p1.setPreferredSize(newDimension(500,50));   JPanel p2 = new JPanel( );   p2.setLayout(newBorderLayout( ));   lblPassword = newJTextField(ResourceHelper.MSG.getMessage(“Sample_Label2”));  p2.add(lblPassword, BorderLayout.WEST);   p2.setPreferredSize(newDimension(250,50));   JPanel p3 = new JPanel( );   p3.setLayout(newBorderLayout( ));   tfEmail = newJTextField(ResourceHelper.MSG.getMessage(“Sample_Hint”));  tfEmail.setPreferredSize(new Dimension(250,50));   p3.add(tfEmail,BorderLayout.WEST);   p3.setPreferredSize(new Dimension(250,50));  JPanel p4 = new JPanel( );   btnOK = newJTextField(ResourceHelper.MSG.getMessage(“Sample_Button”));  p4.add(btnOK);   this.add(p1, BorderLayout.NORTH);   this.add(p2,BorderLayout.WEST);   this.add(p3, BorderLayout.EAST);   this.add(p4,BorderLayout.SOUTH);   this.setLocation(450, 300);   this.setSize(500,400);   this.setPreferredSize(new Ditnension(500, 400));  this.setTitle(“Mail Address”);  this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);  this.setVisible(true);  }  public static void main(String[ ] args) {  new UserLoginPageUpdated( );  } }

In another example, if the application is based on the web browser, i.e,it is a web application. When an application is running, a HTML web pagecan be obtained by the web browser, and then the above code templatescan be read from the plug-in and the code replacement can be done to getupdated HTML web page. Then the web browser can directly open theupdated HTML web page (e.g. updated application) without rebuilding theapplication. FIG. 10 is a flowchart of the method for changing html codeof an application to make information displayed on at least one textresource in the application editable. According to FIG. 10, in step1001, an original application of the updated application is run in a webbrowser. Then in step 1002, a HTML page of the original application isobtained by the web browser. In step 1003, IDs of the at least one textresource from the HTML page and code template related to the HTML pageare determined. Here code templates comprise code with editable textresources according to the type of the source code. Then in step 1004,the ID of each text resource, of the at least one text resource, isinput into the code templates to get replaced templates. Then in step1005, the replaced templates are added to the html page to get updatedapplication which can be directly run in the web browser.

For example, when the method 1000 is applied to the applicationcomprising UI 200 in FIG. 2, html page in the updated application is thesame as the updated source code in the updated application using method700. Here the detailed code is omitted. Using this method, in theapplication in FIG. 2, programmers need not build and deploy theapplication after changing the source code, since html page can be readby a web browser directly.

In some embodiments, a first variable identifier may be set in thesource code of an application in method 700. If the first variableidentifier is set to be “false”, the text resources in the source codeof the application cannot be edited, while if the variable identifier isset to be “true”, the text resources in the source code of theapplication can be edited. The variable identifier can be enabled fromUI by the user so that when the updated source code is built, deployedand run, all the text resources in the application UI can be edited ornot. In some further embodiments, at least one second variableidentifier may be set in the source code of an application in method700. If the first variable identifier is set to be “false”, thecorresponding text resource in the source code of the application cannotbe edited, while if the variable identifier is set to be “true”, thecorresponding text resource in the source code of the application can beedited. The variable identifier can be enabled from UI by the user sothat when the updated source code is built, deployed and run, thecorresponding text resources in the application UI can be edited or not.FIG. 11 is an exemplary interface of FIG. 2 with the first variableidentifier and the second variable identifier corresponding to the ID ofthe text resource “Sample_Label1” (Name). In the FIG. 11, when a userpresses the checkmark, the four text resources can be edited, and whenpressing the checkmark again, the four text resources cannot be edited.Similarly, when a user presses the pen mark, the text resources withSample_Label1 as its ID can be edited, and when the pen mark is pressedagain, the text resources with Sample_Label1 as its ID cannot be edited.When a text resource is enabled to be edited, a user can input correctinformation or translation, etc.

In some embodiments, the checkmark in FIG. 11 can further comprise someselections for the user, for example, some selections may enable alltext resources to be edited or disable all text resources to be edited,or enable the user to submit changes which means the user has finishedthe input for part or all text resources, and NLS file can be created orupdated.

Those skilled in the art can understand that the mark used in FIG. 11 isjust exemplary mark, any kind of mark can be used in this invention.

Besides the source code type of JavaScript and HTML, html or Java, othersource code type, such as C/C++ code can be used in this invention. Theprinciple and implementation are similar. Still, a templatecorresponding to the type of the source code and the ID of the at leastone text resource are determined from the source code and the obtainedIDs of the text resources are input into the templates to get replacedtemplates. The replaced template are added into the source code to getupdated source code. At last, the updated source code is built, deployedand run.

Although idea of the invention is from text resources globalization, themethod can also be used in other scenarios, for example, an applicationhas been developed for a customer, such as a first bank, and othercustomers, such as other banks, have the similar requirements. Theprogrammers can just change the information displayed on the textresources of the application to adapt the requirement of the secondcustomer with this invention. In such scenarios, a file corresponding tothe at least one text resource is not requested to be an NLS file.

The present disclosure may be a system, an apparatus, a device, amethod, and/or a computer program product. The computer program productmay include a computer readable storage medium (or media) havingcomputer readable program instructions thereon for causing a processorto carry out aspects of the present disclosure.

The computer readable storage medium can be a tangible device that canretain and store instructions for use by an instruction executiondevice. The computer readable storage medium may be, for example, but isnot limited to, an electronic storage device, a magnetic storage device,an optical storage device, an electromagnetic storage device, asemiconductor storage device, or any suitable combination of theforegoing. A non-exhaustive list of more specific examples of thecomputer readable storage medium includes the following: a portablecomputer diskette, a hard disk, a random access memory (RAM), aread-only memory (ROM), an erasable programmable read-only memory (EPROMor Flash memory), a static random access memory (SRAM), a portablecompact disc read-only memory (CD-ROM), a digital versatile disk (DVD),a memory stick, a floppy disk, a mechanically encoded device such aspunch-cards or raised structures in a groove having instructionsrecorded thereon, and any suitable combination of the foregoing. Acomputer readable storage medium, as used herein, is not to be construedas being transitory signals per se, such as radio waves or other freelypropagating electromagnetic waves, electromagnetic waves propagatingthrough a waveguide or other transmission media (e.g., light pulsespassing through a fiber-optic cable), or electrical signals transmittedthrough a wire.

Computer readable program instructions described herein can bedownloaded to respective computing/processing devices from a computerreadable storage medium or to an external computer or external storagedevice via a network, for example, the Internet, a local area network, awide area network and/or a wireless network. The network may comprisecopper transmission cables, optical transmission fibers, wirelesstransmission, routers, firewalls, switches, gateway computers and/oredge servers. A network adapter card or network interface in eachcomputing/processing device receives computer readable programinstructions from the network and forwards the computer readable programinstructions for storage in a computer readable storage medium withinthe respective computing/processing device.

Computer readable program instructions for carrying out operations ofthe present disclosure may be assembler instructions,instruction-set-architecture (ISA) instructions, machine instructions,machine dependent instructions, microcode, firmware instructions,state-setting data, or either source code or object code written in anycombination of one or more programming languages, including an objectoriented programming language such as Smalltalk, C++ or the like, andconventional procedural programming languages, such as the “C”programming language or similar programming languages. The computerreadable program instructions may execute entirely on the user'scomputer, partly on the user's computer, as a stand-alone softwarepackage, partly on the user's computer and partly on a remote computeror entirely on the remote computer or server. In the latter scenario,the remote computer may be connected to the user's computer through anytype of network, including a local area network (LAN) or a wide areanetwork (WAN), or the connection may be made to an external computer(for example, through the Internet using an Internet Service Provider).In some embodiments, electronic circuitry including, for example,programmable logic circuitry, field-programmable gate arrays (FPGA), orprogrammable logic arrays (PLA) may execute the computer readableprogram instructions by utilizing state information of the computerreadable program instructions to personalize the electronic circuitry,in order to perform aspects of the present disclosure.

Aspects of the present disclosure are described herein with reference toflowchart illustrations and/or block diagrams of methods, apparatus(systems), and computer program products according to embodiments of thedisclosure. It will be understood that each block of the flowchartillustrations and/or block diagrams, and combinations of blocks in theflowchart illustrations and/or block diagrams, can be implemented bycomputer readable program instructions.

These computer readable program instructions may be provided to aprocessor of a general purpose computer, special purpose computer, orother programmable data processing apparatus to produce a machine, suchthat the instructions, which execute via the processor of the computeror other programmable data processing apparatus, create means forimplementing the functions/acts specified in the flowchart and/or blockdiagram block or blocks. These computer readable program instructionsmay also be stored in a computer readable storage medium that can directa computer, a programmable data processing apparatus, and/or otherdevices to function in a particular manner, such that the computerreadable storage medium having instructions stored therein comprises anarticle of manufacture including instructions which implement aspects ofthe function/act specified in the flowchart and/or block diagram blockor blocks.

The computer readable program instructions may also be loaded onto acomputer, other programmable data processing apparatus, or other deviceto cause a series of operational steps to be performed on the computer,other programmable apparatus or other device to produce a computerimplemented process, such that the instructions which execute on thecomputer, other programmable apparatus, or other device implement thefunctions/acts specified in the flowchart and/or block diagram block orblocks.

The flowchart and block diagrams illustrate the architecture,functionality, and operation of possible implementations of systems,methods and computer program products according to various embodimentsof the present disclosure. In this regard, each block in the flowchartor block diagrams may represent a module, snippet, or portion of code,which comprises one or more executable instructions for implementing thespecified logical function(s). It should also be noted that, in somealternative implementations, the functions noted in the block may occurout of the order noted in the figures. For example, two blocks shown insuccession may, in fact, be executed substantially concurrently, or theblocks may sometimes be executed in the reversed order, depending uponthe functionality involved. It will also be noted that each block of theblock diagrams and/or flowchart illustration, and combinations of blocksin the block diagrams and/or flowchart illustration, can be implementedby special purpose hardware-based systems that perform the specifiedfunctions or acts, or combinations of special purpose hardware andcomputer instructions.

The descriptions of the various embodiments of the present disclosurehave been presented for purposes of illustration, but are not intendedto be exhaustive or limited to the embodiments disclosed. Manymodifications and variations will be apparent to those of ordinary skillin the art without departing from the scope and spirit of the describedembodiments. The terminology used herein was chosen to best explain theprinciples of the embodiments, the practical application or technicalimprovement over technologies found in the marketplace, or to enableothers of ordinary skill in the art to understand the embodimentsdisclosed herein.

What is claimed is:
 1. A computer-implemented method comprising: runningan updated application, wherein information displayed on at least onetext resource in the updated application is editable and informationdisplayed on at least one text resource in an original application ofthe updated application is not editable; in response to a first piece ofinformation displayed on a text resource of the at least one textresource being changed to a second piece of information, obtaining an IDof the text resource of the at least one text resource in the updatedapplication; and mapping the second piece of information to the ID ofthe text resource in a file corresponding to the at least one textresource in the updated application.
 2. The method according to claim 1,wherein mapping the second piece of information to the ID of the textresource in a file corresponding to the at least one text resource inthe updated application comprises: creating the file in response to thefile not existing.
 3. The method according to claim 1, furthercomprising: obtaining source code of the original application; inresponse to the information displayed on the at least one text resourcein the original application being not editable, determining a type ofthe source code, an ID of the at least one text resource, and codetemplates related to the type of the source code which comprise codewith editable text resources; inputting the ID of each text resource ofthe at least one text resource into the code templates to producereplaced templates, adding the replaced templates to produce updatedsource code; and building and deploying the updated source code toproduce the updated application.
 4. The method according to claim 1,further comprising: running the original application in a web browser,obtaining an HTML page of the original application by the web browser;in response to the information displayed on the at least one textresource in the original application being not editable, determining theID of the at least one text resource from the HTML page and codetemplates related to the HTML page which comprise code with editabletext resources; inputting the ID of each text resource of the at leastone text resource into the related code templates to produce replacedtemplates, and adding the replaced templates to the HTML page to producethe updated application which can be directly run in the web browser. 5.The method according to claim 1, wherein the updated applicationcomprises a first variable identifier which can be enabled to make allthe at least one text resource in the application editable from a userinterface (UI) of the application.
 6. The method according to claim 1,wherein the updated application comprises a second variable identifierwhich can be enabled to make a text resource in the application editablefrom a user interface (UI) of the application.
 7. A device comprising: aprocessing unit; a memory coupled to the processing unit and storinginstructions thereon, the instructions, when executed by the processingunit, performing acts including: running an updated application, whereininformation displayed on at least one text resource in the updatedapplication is editable and the information displayed on at least onetext resource in an original application of the updated application isnot editable; in response to a first piece of information displayed on atext resource of the at least one text resource being changed to asecond piece of information, obtaining an ID of the text resource of theat least one text resource in the updated application; and mapping thesecond piece of information to the ID of the text resource in a filecorresponding to the at least one text resource in the updatedapplication.
 8. The device according to claim 7, wherein mapping thesecond piece of information to the ID of the text resource in a filecorresponding to the at least one text resource in the updatedapplication comprises: creating the file in response to the file notexisting.
 9. The device according to claim 7, further comprising:obtaining source code of the original application; in response to theinformation displayed on the at least one text resource in the originalapplication being not editable, determining a type of the source code,and ID of the at least one text resource, and code templates related tothe type of the source code which comprise code with editable textresources; inputting the ID of each text resource of the at least onetext resource into the code templates to produce replaced templates,adding the replaced templates to produce updated source code; andbuilding and deploying the updated source code to produce the updatedapplication.
 10. The device according to claim 7, further comprising:running the original application in a web browser, obtaining an HTMLpage of the original application by the web browser; in response to theinformation displayed on the at least one text resource in the originalapplication being not editable, determining the ID of the at least onetext resource from the HTML page and related code templates related tothe HTML page which comprise code with editable text resources;inputting the ID of each text resource of the at least one text resourceinto the related code templates to produce replaced templates, andadding the replaced templates to the HTML page to produce the updatedapplication which can be directly run in the web browser.
 11. The deviceaccording to claim 7, wherein the updated application comprises a firstvariable identifier which can be enabled to make all the at least onetext resource in the application editable from a user interface (UI) ofthe application.
 12. The device according to claim 7, wherein theupdated application comprises a second variable identifier which can beenabled to make a text resource in the application editable from a userinterface (UI) of the application.
 13. A computer program product beingtangibly stored on a non-transient machine-readable medium andcomprising machine-executable instructions, the instructions, whenexecuted on a device, causing the device to: run an updated application,wherein information displayed on at least one text resource in theupdated application is editable and information displayed on at leastone text resource in an original application of the updated applicationis not editable; in response to a first piece of information displayedon a text resource of the at least one text resource being changed to asecond piece of information, obtain an ID of the text resource of the atleast one text resource in the updated application; and map the secondpiece of information to the ID of the text resource in a filecorresponding to the at least one text resource in the updatedapplication.
 14. The computer program product according to claim 13,wherein map the second piece of information to the ID of the textresource in a file corresponding to the at least one text resource inthe updated application comprises: creating the file in response to thefile not existing.
 15. The computer program product according to claim13, further comprising: obtain source code of the original application;in response to the information displayed on the at least one textresource in the application being not editable, determine a type of thesource code, an ID of the at least one text resource, and code templatesrelated to the type of the source code which comprise code with editabletext resources; input the ID of each text resources of the at least onetext resource into the code templates to produce replaced templates, addthe replaced templates into the source code to produce updated sourcecode; and build and deploy the updated source code to produce theupdated application.
 16. The computer program product according to claim13, further comprising: run the original application in a web browser,obtain an HTML page of the original application by the web browser; inresponse to the information displayed on the at least one text resourcein the application being not editable, determine the ID of the at leastone text resource from the HTML page and code templates related to theHTML page which comprise code with editable text resources; input theIll of each text resource of the at least one text resource into therelated code templates to produce replaced templates, add the replacedtemplates to the HTML page to produce the updated application which canbe directly run in the web browser.
 17. The computer program productaccording to claim 13, wherein the updated application comprises a firstvariable identifier which can be enabled to make all the at least onetext resource in the application editable from a user interface (UI) theapplication.
 18. The computer program product according to claim 13,wherein the updated application comprises a second variable identifierwhich can be enabled to make a text resource in a user interface (UI) ofthe application editable from the application.